
<?php
class Admin
{
 public function add_category(){
 

include('DB.php');

		          $db= new DB;
$name = $_POST['Name'];
  $Sql="INSERT INTO categorys (`Category_Id`, `Name`)
VALUES('NULL','$name')";

    $Que=$db->Query($Sql);
	$db->Disconnect();
                 unset($db);

echo "category add";

}


 public function viwe(){


include('DB.php');

		          $db= new DB;
				  $Sql="SELECT * FROM categorys";	
				      $Que=$db->Query($Sql);

			  

 $result = $Que ;

 while($row = mysqli_fetch_array($result))
   {
   echo $row['Category_Id'] . "-" . $row['Name'];
     echo "   ";

   echo "<a href='GUI_update2.php?id=$row[Category_Id]'>update</a>";
   

   echo "<br>";
   }
   
	$db->Disconnect();
                 unset($db);
 }
 public function update($id)
 {
     
include('DB.php');

		          $db= new DB;
	 $name = $_POST['Name'];
	// $O=$_POST['mr'];
$Sql="UPDATE  categorys SET Name ='$name' WHERE Category_Id='$id'";
	  $Que=$db->Query($Sql);
	 $db->Disconnect();
                 unset($db);
 }
 
 }

 
?>